package net.srcz.jsjvm2;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;

import org.objectweb.asm.Opcodes;

public class OpCodesNames {
	
	private static Map<Integer,String> map = new HashMap<Integer,String>();
	
	static {
		for(Field f : Opcodes.class.getDeclaredFields()) {
			try {
				Object val = f.get(null);
				if(!(val instanceof Integer))
					continue;
				map.put((Integer)val, f.getName());
			} catch (Throwable e) {
				e.printStackTrace();
			}
		}
	}
	
	
	public static String get(int opcode) {
		return map.get(opcode);
	}
}
